class Solution {
public:
    vector<int> processQueries(vector<int>& queries, int m)
    {
        vector<int> ret;
        vector<int> arr(m);
        for (int i = 0; i < m; ++i)
            arr[i] = i + 1;
        for (auto ch : queries)
        {
            int mark = 0;
            for (int j = 0; j < arr.size(); ++j)
            {
                if (arr[j] == ch)
                {
                    mark = j;
                    ret.push_back(j);
                    break;
                }
            }


            int tmp = arr[mark];
            for (int i = mark; i > 0; --i)
                arr[i] = arr[i - 1];
            arr[0] = tmp;

        }
        return ret;

    }
};